<?php

namespace app\home\controller;

use app\BaseController;
use think\App;
use think\facade\Db;

class Index extends BaseController
{
    //首页
    public function index()
    {
        $banner = Db::name('banner')->where(['venues_id' => input('venues_id')])->field('id,images')->limit(5)->order('sort asc')->select()->toArray();

        $cloudera = Db::name('cloudera')->where(['venues_id' => input('venues_id')])->field('id,images')->limit(1)->find();
        $news = Db::name('news')->where(['venues_id' => input('venues_id')])->field('id,title,describe,images')->limit(5)->order('sort asc')->select()->toArray();
        return outputJson(1000, 'ok', ['banner' => $banner, 'cloudera' => $cloudera, 'news' => $news]);
    }

    //云上时代详情
    public function clouderaDetail(){
        $cloudera = Db::name('cloudera')->where(['id' => input('id')])->field('images,title,content')->find();
        return outputJson(1000, 'ok', ['cloudera' => $cloudera]);
    }

    //新闻详情
    public function newsDetail(){
        $news = Db::name('news')->where(['id' => input('id')])->field('title,content,images')->find();
        return outputJson(1000, 'ok', ['news' => $news]);
    }
}
